package net;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.SocketException;

public class UDPClient {
	
	public static void main(String[] args) throws Exception {
		InetAddress ip=InetAddress.getLocalHost(); 
		//准备一个包裹
		byte buf[]="你好，一个快递".getBytes();
		DatagramPacket packet=new DatagramPacket(buf, buf.length, ip, 8899);
		//发消息
		DatagramSocket socket=new DatagramSocket();	
		socket.send(packet);
		socket.close();
		
		
	}

}
